//============================================================================
// Name        : FileSystemv2.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include "Device.h"
#include "FileSystem.h"

#include <cstdlib>		// for: EXIT_SUCCESS, EXIT_FAILURE

#include "ansi.h"		// for: ANSI color codes
#include "asserts.h"	// for: asserts checking
#include "unix_error.h"	// for: system error reporting

using namespace std;

int main(int argc, const char *argv[]) {

	try {
			// a given parameter or use the default ?
			FileSystem sbi((argc > 1) ? argv[1] : "floppie.img"); //n10 ; n104 ; n42
			sbi.printSuperBlockInfo();
			sbi.printDumpOfFreelist();
			sbi.printDumpOfInodesAndDirs();

			//FreelistInfo fld;
			//fld.printInfo((argc > 1) ? argv[1] : "floppie.img");

			return EXIT_SUCCESS;
		} catch(const std::exception& e) {
			std::cerr << AC_RED "OOPS: " << e.what() << AA_RESET << std::endl;
			return EXIT_FAILURE;
		} catch(...) {
			std::cerr << AC_RED "OOPS: something went wrong" AA_RESET << std::endl;
			return EXIT_FAILURE;
		}
}
